{% extends "base.html" %}

{% block content %}
<div class="container mt-4">
    <div class="d-flex align-items-center mb-4">
        <i class="bi bi-file-earmark-plus fs-3 text-primary me-2"></i>
        <h2 class="mb-0">创建需求</h2>
    </div>

    <div class="card shadow-sm">
        <div class="card-body p-4">
            <form method="POST">
                {{ form.hidden_tag() }}
                
                <!-- 基本信息 -->
                <h5 class="mb-3 pb-2 border-bottom">需求基本信息</h5>
                <div class="row g-3 mb-4">
                    <div class="col-md-6">
                        {{ form.hierarchy_node_id.label(class="form-label") }}
                        <div class="input-group">
                            <span class="input-group-text"><i class="bi bi-diagram-3"></i></span>
                            {{ form.hierarchy_node_id(class="form-select") }}
                        </div>
                        <div class="form-text">选择需求所属业务层级</div>
                    </div>
                    <div class="col-md-6">
                        {{ form.type_id.label(class="form-label") }}
                        <div class="input-group">
                            <span class="input-group-text"><i class="bi bi-tags"></i></span>
                            {{ form.type_id(class="form-select") }}
                        </div>
                        <div class="form-text">选择需求类型</div>
                    </div>
                </div>
                
                <!-- 时间信息 -->
                <h5 class="mb-3 pb-2 border-bottom mt-4">时间信息</h5>
                <div class="row g-3 mb-4">
                    <div class="col-md-6">
                        {{ form.request_time.label(class="form-label") }}
                        <div class="input-group">
                            <span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
                            {{ form.request_time(class="form-control", type="datetime-local") }}
                        </div>
                    </div>
                    <div class="col-md-6">
                        {{ form.expected_solve_time.label(class="form-label") }}
                        <div class="input-group">
                            <span class="input-group-text"><i class="bi bi-calendar-check"></i></span>
                            {{ form.expected_solve_time(class="form-control", type="datetime-local") }}
                        </div>
                    </div>
                </div>
                
                <!-- 优先级评估 -->
                <h5 class="mb-3 pb-2 border-bottom mt-4">优先级评估</h5>
                <div class="row g-3 mb-4">
                    <div class="col-md-4">
                        {{ form.business_value.label(class="form-label") }}
                        <div class="input-group">
                            <span class="input-group-text"><i class="bi bi-currency-dollar"></i></span>
                            {{ form.business_value(class="form-select") }}
                        </div>
                    </div>
                    <div class="col-md-4">
                        {{ form.complexity.label(class="form-label") }}
                        <div class="input-group">
                            <span class="input-group-text"><i class="bi bi-bar-chart-steps"></i></span>
                            {{ form.complexity(class="form-select") }}
                        </div>
                    </div>
                    <div class="col-md-4">
                        {{ form.urgency.label(class="form-label") }}
                        <div class="input-group">
                            <span class="input-group-text"><i class="bi bi-hourglass-split"></i></span>
                            {{ form.urgency(class="form-select") }}
                        </div>
                    </div>
                </div>
                
                <!-- 需求描述 -->
                <h5 class="mb-3 pb-2 border-bottom mt-4">详细描述</h5>
                <div class="row g-3 mb-4">
                    <div class="col-md-6">
                        {{ form.value_metric.label(class="form-label") }}
                        <div class="input-group">
                            <span class="input-group-text"><i class="bi bi-graph-up-arrow"></i></span>
                            {{ form.value_metric(class="form-control") }}
                        </div>
                        <div class="form-text">例如：处理时间减少30%</div>
                    </div>
                    <div class="col-md-6">
                        {{ form.impact_dimensions.label(class="form-label") }}
                        <div class="input-group">
                            <span class="input-group-text"><i class="bi bi-arrows-angle-expand"></i></span>
                            {{ form.impact_dimensions(class="form-control") }}
                        </div>
                        <div class="form-text">例如：组织与人员,技术系统</div>
                    </div>
                </div>
                
                <div class="mb-4">
                    {{ form.description.label(class="form-label") }}
                    <div class="input-group">
                        <span class="input-group-text"><i class="bi bi-journal-text"></i></span>
                        {{ form.description(class="form-control", rows=4) }}
                    </div>
                </div>
                
                <!-- 解决方案负责人 -->
                <h5 class="mb-3 pb-2 border-bottom mt-4">责任人信息</h5>
                <div class="row g-3 mb-4">
                    <div class="col-md-6">
                        {{ form.solution_owner.label(class="form-label") }}
                        <div class="input-group">
                            <span class="input-group-text"><i class="bi bi-person-badge"></i></span>
                            {{ form.solution_owner(class="form-control") }}
                        </div>
                        <div class="form-text">填写解决方案负责人姓名</div>
                    </div>
                </div>
                
                <!-- 操作按钮 -->
                <div class="d-flex justify-content-end gap-2 pt-3">
                    <a href="{{ url_for('requirements.kanban') }}" class="btn btn-outline-secondary">
                        <i class="bi bi-x-circle"></i> 取消
                    </a>
                    <button type="submit" class="btn btn-primary">
                        <i class="bi bi-save"></i> 创建需求
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
{% endblock %}